package com.fpx.open.platform.service.impl;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import com.fpx.open.platform.common.constant.ErrorCodeConstant;
import com.fpx.open.platform.dao.mapper3.ActionLogDetailMapper;
import com.fpx.open.platform.dao.mapper3.ActionLogMapper;
import com.fpx.open.platform.domain.ActionLog;
import com.fpx.open.platform.domain.exception.ServiceException;
import com.fpx.open.platform.service.ActionLogService;

/**
 * 日志接口类
 * @author sunkey
 * @date Mar 22, 2013 3:37:57 PM
 * @version 1.0.0 
 * @copyright fpx.com 
 */
//@Service(value="actionLogService")
public class ActionLogServiceImpl implements ActionLogService{
	
	private final Logger logger = LoggerFactory.getLogger(getClass());
	
	@Resource
	private ActionLogMapper actionLogMapper;
	
	@Resource
	private ActionLogDetailMapper actionLogDetailMapper;

	/**
	 * @see com.com.fpx.open.platform.service.api.ActionLogService.saveActionLog
	 */
	@Override
	public void saveActionLog(ActionLog actionLog) throws ServiceException{
		if(logger.isDebugEnabled()){
			logger.debug("actionLog={}", actionLog);
		}
		
		
		try {
			
			actionLogMapper.insert(actionLog);
			
			actionLogDetailMapper.insert(actionLog);
			
		} catch (Exception e) {
			logger.error("DB access failer", e);
			throw new ServiceException("DB access failer", ErrorCodeConstant.E_0104);
		}
		
	}

}
